import request from '@/utils/request'

// 查询容器 懒加载
export function lazyTree(parentId) {
  return request({
    url: '/biobank/container/lazyTree/' + parentId,
    method: 'get'
  })
}

// 查询容器 列表
export function listContainer(query) {
  return request({
    url: '/biobank/container/list',
    method: 'get',
    params: query
  })
}

// 查询容器下的盒子容器
export function getLeaf(query) {
  return request({
    url: '/biobank/container/getLeaf',
    method: 'get',
    params: query
  })
}

// 查询容器 详细
export function getContainer(containerId) {
  return request({
    url: '/biobank/container/' + containerId,
    method: 'get'
  })
}

// 新增容器
export function addContainer(data) {
  return request({
    url: '/biobank/container',
    method: 'post',
    data: data
  })
}

// 批量新增容器
export function batchAddContainer(data) {
  return request({
    url: '/biobank/container/batchAdd',
    method: 'post',
    data: data,
    timeout: 100000
  })
}

// 复制容器
export function copyContainer(data) {
  return request({
    url: '/biobank/container/copy',
    method: 'post',
    data: data,
    timeout: 100000
  })
}

// 修改容器
export function updateContainer(data) {
  return request({
    url: '/biobank/container',
    method: 'put',
    data: data,
    timeout: 100000
  })
}

// 删除容器
export function delContainer(containerId) {
  return request({
    url: '/biobank/container/' + containerId,
    method: 'delete'
  })
}

// 计算各个容器当前存储样本数并更新
export function calculateSampleCount() {
  return request({
    url: '/biobank/container/calculateSampleCount',
    method: 'get'
  })
}
